﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace TransportHierarchyWithForms
{
    class Accountant
    {
        private double sum = 0;

        public double Sum
        {
            get
            {
                return sum;
            }
            set
            {
                sum = value;
            }
        }

        public double SumCost(Transport transport)
        {
            this.Sum = 0;
            for (uint i = 0; i < transport.NumberOfRouts; i++)
            {
                this.Sum += transport.routes[i].Cost;
            }
            return this.Sum;
        }

        public override string ToString()
        {
            return "Full cost of routes is: " + Sum.ToString();
        }

        public Accountant()
        {
            sum = 0;
        }
    }
}
